<?xml version="1.0" encoding="utf-8"?>
<process version="1" name="WDZ" 
	xmlns="http://www.nginn.org/WorkflowDefinition.1_0.xsd" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:gui="http://www.nginn.org/NGinnGui"
	xmlns:ngidx="http://www.nginn.org/Indexing">
    <dataTypes>
		<enum name="CaseClassification">
            <value>Completed</value>
            <value>SendToExpert1</value>
			<value>SendToExpert2</value>
        </enum>
		<enum name="ExpertSolutionCode">
			<value>Solved</value>
			<value>ReturnToClassification</value>
			<value>Cancelled</value>
		</enum>
    </dataTypes>
    <variables>
		<variable name="DocumentId" type="string" required="true" dir="In" />
		<variable name="Classification" type="CaseClassification" required="false" dir="Local" />
		<variable name="ExpertSolution" type="ExpertSolutionCode" required="false" dir="Local" />
    </variables>
    <body>
        <places>
            <place id="start" type="Start" />
            <place id="end" type="End" />
        </places>
        <tasks>
            <task id="FirstClassification" type="Manual" joinType="XOR" splitType="XOR">
			<variables>
				<variable name="DocumentId" type="string" required="true" dir="In"  />
				<variable name="Classification" type="CaseClassification" dir="Out" required="true">
					<defaultValue>'Completed'</defaultValue>
				</variable>
				<variable name="comment" type="string" dir="Out" required="true" />
			</variables>
			<parameters>
				<param variable="AssigneeId"><value>1</value></param>
				<param variable="Title"><expr>"WDZ nr ${data.DocumentId}"</expr></param>
				<param variable="Description"><expr>"WDZ nr ${data.DocumentId}"</expr></param>
			</parameters>
            </task>
		
		<task id="Expert1" type="Manual" joinType="XOR" splitType="XOR">
			<variables>
				<variable name="DocumentId" type="string" required="true" dir="In"  />
				<variable name="ExpertSolution" type="ExpertSolutionCode" dir="Out" required="true">
					<defaultValue>'Solved'</defaultValue>
				</variable>
				<variable name="comment" type="string" dir="Out" required="true" />
			</variables>
			<parameters>
				<param variable="AssigneeId"><value>1</value></param>
				<param variable="Title"><expr>"WDZ nr ${data.DocumentId}"</expr></param>
				<param variable="Description"><expr>"WDZ nr ${data.DocumentId}"</expr></param>
			</parameters>
            </task>
			
			<task id="Expert2" type="Manual" joinType="XOR" splitType="XOR">
			<variables>
				<variable name="DocumentId" type="string" required="true" dir="In"  />
				<variable name="ExpertSolution" type="ExpertSolutionCode" dir="Out" required="true">
					<defaultValue>'Solved'</defaultValue>
				</variable>
				<variable name="comment" type="string" dir="Out" required="true" />
			</variables>
			<parameters>
				<param variable="AssigneeId"><value>1</value></param>
				<param variable="Title"><expr>"WDZ nr ${data.DocumentId}"</expr></param>
				<param variable="Description"><expr>"WDZ nr ${data.DocumentId}"</expr></param>
			</parameters>
            </task>
        </tasks>
		
        <flows>
            <flow from="start" to="FirstClassification" />
			<flow from="FirstClassification" to="Expert1" evalOrder="1">
				<inputCondition>data.Classification == 'SendToExpert1'</inputCondition>
			</flow>
			<flow from="FirstClassification" to="Expert2" evalOrder="2">
				<inputCondition>data.Classification == 'SendToExpert2'</inputCondition>
			</flow>
			<flow from="FirstClassification" to="end" evalOrder="3" />
			<flow from="Expert1" to="FirstClassification" evalOrder="1">
				<inputCondition>data.ExpertSolution == 'ReturnToClassification'</inputCondition>
			</flow>
			<flow from="Expert1" to="end" evalOrder="2" />
			<flow from="Expert2" to="FirstClassification" evalOrder="1">
				<inputCondition>data.ExpertSolution == 'ReturnToClassification'</inputCondition>
			</flow>
			<flow from="Expert2" to="end" evalOrder="2" />
		</flows>
    </body>
</process>